<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 17-2-22
 * Time: 上午11:36
 */

namespace clazz;
interface A
{
    function run();
}

abstract class AA implements A
{
    public abstract function say();
}

class AAA extends AA
{
    function run()
    {
        echo __CLASS__;
    }

    public function say()
    {
    }
}

class BBB extends AA
{
    function run()
    {
        echo __CLASS__;
    }

    public function say()
    {
    }
}


function runClazz(AA $aa)
{
    $aa->run();
}


/**
 * Class CCC
 * @package clazz
 */
class CCC extends AA implements A
{
    function run()
    {
        echo __CLASS__;
    }

    public function say()
    {
        echo PHP_EOL.__METHOD__;
    }

    public static function quiet(){
        echo 'this is a status function';
    }
}

runClazz(new AAA());
runClazz(new BBB());
runClazz(new CCC());

(new CCC())->say();

$class = \clazz\CCC::class;
echo $class;
$reflectionClass = new \ReflectionClass($class);
echo $reflectionClass->getDocComment();

\clazz\CCC::quiet();


function such(...$a){
    echo gettype($a);
    if (is_array($a)){
        print_r($a);
    }else{
        echo $a;
    }
}

such([1,2,3,4,5,6,7]);
such(1);

such(...[11,22]);
such([11,22]);
such(11,22);



function such2(&...$a){
    $a = null;
}

$a = "qwe";
such2($a);
print_r($a);


function foo(&...$args)
{
    $i = 0;
    foreach ($args as &$arg) {
        $arg = ++$i;
    }
}
foo($a, $b, $c);
echo 'a = ', $a, ', b = ', $b, ', c = ', $c;




